The basic background for a DiagramSurface is controlled by the standard Background property. This can be set to any brush, allowing you to use graphics or gradients as backgrounds for your diagram.
If you are using snapping, you may want to draw the snap lines over the background. To do this, set the DiagramSurface.SnapLineDrawing property to an ISnapLineDrawing. The toolkit includes three standard snap line drawing implementations:
- IntersectionSnapLineDrawing draws a dot at each snap line intersection. This is similar to the grid display in the Visual Studio Windows Forms designer or of many vector drawing programs.
- LineSnapLineDrawing draws the snap lines. This is similar to the “show guidelines” view of vector drawing programs.
- IntervalLineSnapLineDrawing draws the snap lines, but draws every nth line in a different style (typically emphasised). This produces an effect similar to mathematical graph paper.
You can control the exact appearance of each line drawing using brushes or pens. For example:
CopyDrawing snap lines
<Window.Resources> <ms:IntervalLineSnapLineDrawing x:Key="SnapLineDrawing"> <ms:IntervalLineSnapLineDrawing.MainPen> <Pen Brush="DarkGreen" Thickness="0.1" /> </ms:IntervalLineSnapLineDrawing.MainPen> <ms:IntervalLineSnapLineDrawing.IntervalPen> <Pen Brush="Black" Thickness="0.3" /> </ms:IntervalLineSnapLineDrawing.IntervalPen> </ms:IntervalLineSnapLineDrawing> </Window.Resources> <ms:DiagramSurface SnapLineDrawing="{StaticResource GraphPaper}" />
You can create your own implementations of ISnapLineDrawing if you want to render snapping information in your own custom style.